package com.vdf.sisconsolid.persistencemodule.model;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * The persistent class for the consolidation database table.
 * 
 */
@Entity
@Table(name = "consolidation")
public class Consolidation implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(nullable = false)
	private Long id;

	@Column(name = "attended_church")
	private boolean attendedChurch;

	@Column(name = "which_church", length = 150)
	private String whichChurch;

	@Column(name = "attend_cell")
	private boolean attendCell;

	private byte years;

	@Column(name = "visiting_day", length = 100)
	private String visitingDay;

	@Column(name = "contact_time", nullable = false, length = 100)
	private String contactTime;

	@Temporal(TemporalType.DATE)
	@Column(nullable = false)
	private Date date;

	@Column(name = "invited_by", nullable = false, length = 150)
	private String invitedBy;

	@Column(nullable = false)
	private int state;

	@Column(nullable = false, length = 500)
	private String need;

	@Column(length = 500)
	private String observation;

	@Column(nullable = false, length = 200)
	private String occupation;

	// bi-directional many-to-one association to Cell
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "id_cell")
	private Cell cell;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "id_took_data")
	private Consolidator tookData;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "id_assigned_to")
	private Consolidator assignedTo;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "id_person")
	private Person person;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "id_service")
	private Service service;

	@OneToMany(mappedBy = "consolidation")
	private List<Tracing> tracings;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "id_net")
	private Net net;

	public Consolidation() {
	}

	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public boolean getAttendedChurch() {
		return this.attendedChurch;
	}

	public void setAttendedChurch(boolean attendedChurch) {
		this.attendedChurch = attendedChurch;
	}

	public String getContactTime() {
		return this.contactTime;
	}

	public void setContactTime(String contactTime) {
		this.contactTime = contactTime;
	}

	public Date getDate() {
		return this.date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public String getInvitedBy() {
		return this.invitedBy;
	}

	public void setInvitedBy(String invitedBy) {
		this.invitedBy = invitedBy;
	}

	public String getNeed() {
		return this.need;
	}

	public void setNeed(String need) {
		this.need = need;
	}

	public String getObservation() {
		return this.observation;
	}

	public void setObservation(String observation) {
		this.observation = observation;
	}

	public String getOccupation() {
		return occupation;
	}

	public void setOccupation(String occupation) {
		this.occupation = occupation;
	}

	public Cell getCell() {
		return this.cell;
	}

	public void setCell(Cell cell) {
		this.cell = cell;
	}

	public Person getPerson() {
		return this.person;
	}

	public void setPerson(Person person) {
		this.person = person;
	}

	public Service getService() {
		return this.service;
	}

	public void setService(Service service) {
		this.service = service;
	}

	public List<Tracing> getTracings() {
		return this.tracings;
	}

	public void setTracings(List<Tracing> tracings) {
		this.tracings = tracings;
	}

	public Net getNet() {
		return this.net;
	}

	public void setNet(Net net) {
		this.net = net;
	}

	public Consolidator getTookData() {
		return tookData;
	}

	public void setTookData(Consolidator tookData) {
		this.tookData = tookData;
	}

	public Consolidator getAssignedTo() {
		return assignedTo;
	}

	public void setAssignedTo(Consolidator assignedTo) {
		this.assignedTo = assignedTo;
	}

	public int getState() {
		return state;
	}

	public void setState(int state) {
		this.state = state;
	}

	public void setIdCell(Long idCell) {
		if (idCell == null)
			return;
		cell = new Cell();
		cell.setId(idCell);

	}

	public void setIdAssignedTo(Long idAssignedTo) {
		if (idAssignedTo == null)
			return;
		assignedTo = new Consolidator();
		assignedTo.setId(idAssignedTo);
	}

	public void setIdNet(Long idNet) {
		if (idNet == null)
			return;
		net = new Net();
		net.setId(idNet);
	}

	public void setIdService(Long idService) {
		if (idService == null)
			return;
		service = new Service();
		service.setId(idService);
	}

	public void setIdTookData(Long idTookData) {
		if (idTookData == null)
			return;
		tookData = new Consolidator();
		tookData.setId(idTookData);
	}

	public String getWhichChurch() {
		return whichChurch;
	}

	public void setWhichChurch(String whichChurch) {
		this.whichChurch = whichChurch;
	}

	public boolean getAttendCell() {
		return attendCell;
	}

	public void setAttendCell(boolean attendCell) {
		this.attendCell = attendCell;
	}

	public byte getYears() {
		return years;
	}

	public void setYears(byte years) {
		this.years = years;
	}

	public String getVisitingDay() {
		return visitingDay;
	}

	public void setVisitingDay(String visitingDay) {
		this.visitingDay = visitingDay;
	}
}